package com.example.admin.system.controller;

import com.example.common.autil.SpringContextUtil;
import com.example.common.config.properties.ProjectProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * 项目登录controller
 * @author zjm
 * @date 2020-09-08
 */
@Controller
public class LoginController implements ErrorController {

/*    @Autowired
    private RoleService roleService;*/

    /**
     * 跳转到登录页面
     */
    @GetMapping("/login")
    public String toLogin(Model model) {
        ProjectProperties properties = SpringContextUtil.getBean(ProjectProperties.class);
        model.addAttribute("isCaptcha", properties.isCaptchaOpen());
        return "/login";
    }


    @Override
    public String getErrorPath() {
        return "/error";
    }
}
